package com.wangjiyuan.giftshuo.ui.fragment.classify.shop;

import com.wangjiyuan.giftshuo.bean.classifybean.shop.TreeBean;
import com.wangjiyuan.giftshuo.config.classify.ClassifyURL;
import com.wangjiyuan.giftshuo.http.classityretrofitinterface.RetrofitInterface;
import com.wangjiyuan.giftshuo.utils.OkHttp3Helper;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;

/**
 * Created by QXL on 2016/11/18.
 */

public class ShopModel implements ShopContract.IShopModel {
    @Override
    public Observable<TreeBean> getTreeObservable() {
        Retrofit retrofit=new Retrofit.Builder()
                .baseUrl(ClassifyURL.BASE_URL)
                .client(OkHttp3Helper.getOkHttpSingletonInstance())
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .build();
        RetrofitInterface retrofitInterface = retrofit.create(RetrofitInterface.class);
        Observable<TreeBean> treeObservable = retrofitInterface.getTreeObservable();
        return treeObservable;
    }
}
